package com.jic.order.impl;

import com.jic.common.base.vo.Page;
import com.jic.order.entity.OrderProcessLog;
import com.jic.order.mapper.OrderProcessLogMapper;
import com.jic.common.base.vo.PageResult;
import com.jic.order.service.OrderProcessLogService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单操作日志表
 *
 * @author : yinhaijun
 * @version : v1.0.0
 * @email :
 * @since : 2020-01-15 04:52:24
 */
@Service
public class OrderProcessLogServiceImpl implements OrderProcessLogService {

	@Autowired
	private OrderProcessLogMapper orderProcessLogMapper;

	@Override
	public long insert(OrderProcessLog orderProcessLog) {
		long flag = orderProcessLogMapper.insert(orderProcessLog);
		return flag;
	}

	@Override
	public long delete(Long id) {
		return orderProcessLogMapper.delete(id);
	}

	@Override
	public long update(OrderProcessLog orderProcessLog) {
		return orderProcessLogMapper.update(orderProcessLog);
	}

	@Override
	public OrderProcessLog queryByPrimaryKey(Long id) {
		return orderProcessLogMapper.queryByPrimaryKey(id);
	}

	@Override
	public List<OrderProcessLog> query(OrderProcessLog orderProcessLog) {
		return orderProcessLogMapper.query(orderProcessLog);
	}

	@Override
	public PageResult<OrderProcessLog> queryPage(OrderProcessLog orderProcessLog, Page pageQuery) {
		//计算下标
		int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
		List<OrderProcessLog> list = orderProcessLogMapper.queryPage(startIndex, pageQuery.getLimit(), orderProcessLog);
		long count = orderProcessLogMapper.queryPageCount(orderProcessLog);
		PageResult pageResult = new PageResult();
		pageResult.setRows(list);
		pageResult.setTotal(count);
		return pageResult;
	}
}